using Dapper.Contrib.Extensions;
using Publicuse.Entity.AttributeUtil;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Publicuse.Entity
{
    /// <summary>
    /// 角色权限资源管理
    /// </summary>
    [DBTable("`geeker-urpermission`", "角色权限资源信息")]
    [Table("`geeker-urpermission`")]
    [SugarTable("`geeker-urpermission`")]
    public class URPermission : BaseModel<long>
    {

        [Remark("角色编号")]
        public long rId { get; set; }

        [Remark("资源编号")]
        public string aIds { get; set; }

        [Remark("用户编号")]
        public long uId { get; set; }

        [NoInsert]
        [Write(false)]
        [SugarColumn(IsIgnore = true)]
        public string rname { get; set; }

        [NoInsert]
        [Write(false)]
        [SugarColumn(IsIgnore = true)]
        public string aname { get; set; }

        [NoInsert]
        [Write(false)]
        [SugarColumn(IsIgnore = true)]
        public string uCode { get; set; }

        [NoInsert]
        [Write(false)]
        [SugarColumn(IsIgnore = true)]
        public string rName { get; set; }

        [NoInsert]
        [Write(false)]
        [SugarColumn(IsIgnore = true)]
        public string resName { get; set; }

        [NoInsert]
        [Write(false)]
        [SugarColumn(IsIgnore = true)]
        public string aId { get; set; }

        public URPermission()
        {
            this.Id = 0;
        }
    }

    /// <summary>
    /// 角色权限资源列表信息
    /// </summary>
    public class URPermissionExtend : URPermission
    {
        [NoQuery]
        [Remark("资源名称")]
        public string aName { get; set; }
        [NoQuery]
        [Remark("角色名称")]
        public string rName { get; set; }

        public URPermissionExtend()
        {
            this.aName = string.Empty;
            this.rName = string.Empty;
        }
    }

    /// <summary>
    /// 登录用户角色权限资源列表
    /// </summary>
    public class RoleResourceUR
    {
        public string aName { get; set; }

        public string aapiUrl { get; set; }

        public string ahtmlUrl { get; set; }

        public int aParentId { get; set; }

        public int aId { get; set; }

        public int aType { get; set; }

        public int amoduleIndex { get; set; }

        public string ahtmlIcon { get; set; }

        public string abName { get; set; }

        public string abIcon { get; set; }
    }

    /// <summary>
    /// 角色权限查询参数
    /// </summary>
    public class URPermissionQuery : CommonQuery
    {
        public int urId { get; set; }

        public string aName { get; set; }

        public string rName { get; set; }

        public URPermissionQuery()
        {
            this.exportName = GetExportName;
        }
        public static string GetExportName
        {
            get { return "URPermission"; }
        }
    }
}
